<?php

namespace App\Api\Eloquent;


class Article extends Model
{
    protected  $fillable=[];

    //获取单篇文章的详情
    public static function getOne($id){
        if($id==51){
            $article=Article::where('id','=',$id)
                ->first();
        }else{
            $article=Article::where('id','=',$id)
                ->where('display','=','1')//显示
                ->where('recommended','=','1')//推荐
                ->where('published_at','<=',date('Y-m-d H:i:s'))//已发布
                ->first();
        }
        return $article;
    }
}